-
Notifications
You must be signed in to change notification settings - Fork 751
fix(amazonq): Prevent adding same file twice for /doc and /dev #6568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(amazonq): Prevent adding same file twice for /doc and /dev #6568
Conversation
|
| const addedFilePaths = new Set() | ||
|
|
||
| for (const file of files) { | ||
| if (addedFilePaths.has(file.zipFilePath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does collectFiles returns same file path if sourcePaths/repoRootPaths > 1 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have a file that shows up in a multi root workspace more than once, then collectFiles will output it multiple times, all with the same zipFilePath
|
Duplicate code CI failure: none of the files in this PR are listed |
|
/runIntegrationTests |
|
Can we create some tests for this? |
I confirmed that the unit test I added fails if I revert the fix, with the same error that causes the user facing bug. |
| const workspace2 = getWorkspaceFolder(folder.path + '/innerFolder') | ||
| const folderName = path.basename(folder.path) | ||
|
|
||
| await testPrepareRepoData([workspace1, workspace2], [`${folderName}_${workspace1.name}/${testFilePath}`]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're mostly just testing that this doesn't reject right? Does it make sense to wrap this with:
assert.doesNotReject(() => {
await testPrepareRepoData([workspace1, workspace2], [`${folderName}_${workspace1.name}/${testFilePath}`])
})
? otherwise the PR looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the testPrepareRepoData has asserts inside of it, which will fail if the function fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error thrown by the test would be Error: File already exists at ZipWriter.add which indicates the root cause, the extra assert is not needed
Problem
Stuck on "Uploading code..." for /dev and /doc in a multi-root workspace with the same file paths in it multiple times.
Solution
Add a check to prevent same file from being added to archive twice
Fixes issue #6566
feature/xbranches will not be squash-merged at release time.